package geektime.spring.studentdemo.mapper;


import geektime.spring.studentdemo.model.StudentMath;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMathMapper {

    @Insert("insert into t_studentmath(studentName,achievement,classId) " +
            "values (#{studentName}, #{achievement}, #{classId})")
    @Options(useGeneratedKeys = true)
    int save();

    @Select("select * from t_studentmath order by achievement desc")
    List<StudentMath> findAll();

}
